Enterprise Wallet API Documentation
Introduction
Welcome to the OpenBlock developer documentation!
You can use the OpenBlock API to:
- Create/approve transactions
- Get enterprise wallet balance and transaction history
- Receive webhook notifications for enterprise wallet related events
- ......
Compared to traditional methods, the API allows for increased efficiency, reduced costs, and automation of enterprise wallet management.
Welcome to manage your wallet with the OpenBlock API. We provide comprehensive documentation and code samples, as well as professional technical support to assist you. The documentation is designed for developers worldwide to integrate with the platform.
Get Started
Overview
Please use a user account with enterprise wallet management to log in to OpenBlock and switch to the enterprise wallet, enter the enterprise wallet management page, manage payment plan, API account creation and Webhook configuration on the API
tab in the left column. After the API account is successfully created, you can use the API Key to access the enterprise wallet API.
API Authentication
GET Request
GET request signing steps:
Let all sent or received data be set M, and add a nonce parameter to set M, where nonce can be uuid.
Sort the parameter values of the non-empty parameters in set M in ascending order by parameter name ASCII code (dictionary order), and concat them into a string stringA in the format of URL key-value pairs (i.e. key1=value1&key2=value2...).
Special note:
Sort parameter names in ascending order by ASCII code (dictionary order)
Empty parameter values do not participate in signing
Parameter names are case sensitive
Concat api_key to the end of stringA to get stringSignTemp string.
Use api_secret to get the uppercase hex SHA256 string of stringA to get the sign value for the request.
Concat &sign=sign after the stringSignTemp string to get the final signed string.
Example:
Suppose the user's api_key is: kkkkkkkkk, and api_secret is: ccccccccc. The original url of a request is openapi.openblock.com/api/v1/xxx?a=111&b=222&c=333
Add nonce and sort to get stringA: a=111&b=222&c=333&nonce=09B7D140-9A8A-4D31-82CF-8B343B2301A7
Concat api_key to stringA to get stringSignTemp: a=111&b=222&c=333&nonce=09B7D140-9A8A-4D31-82CF-8B343B2301A7&api_key=kkkkkkkkk
Use api_secret to get uppercase hex SHA256 of stringSignTemp to get sign: 85F79F53AC252C8547CD2866C09BA9A6F66ABA0407E84E1DDAED16A97C9ACDC7
Concat sign to stringSignTemp: a=111&b=222&c=333&nonce=09B7D140-9A8A-4D31-82CF-8B343B2301A7&api_key=kkkkkkkkk&sign=85F79F53AC252C8547CD2866C09BA9A6F66ABA0407E84E1DDAED16A97C9ACDC7
Signing ends.
POST Request
POST request signing steps:
Same as GET request.
Put nonce, api_key, sign in body.
If body is in JSON format, add corresponding key-value directly in JSON.
Example:
Suppose user's api_key is: kkkkkkkkk, api_secret is: ccccccccc. Body of a request is:
{
"a": "111",
"b": "222",
"c": "333"
}
Add nonce and sort to get stringA: a=111&b=222&c=333&nonce=08AE0435-E68B-4460-835B-15475B58B75C
Concat api_key to stringA to get stringSignTemp: a=111&b=222&c=333&nonce=08AE0435-E68B-4460-835B-15475B58B75C&api_key=kkkkkkkkk
Use api_secret to get uppercase hex SHA256 of stringSignTemp to get sign: 7D2D6314B659E96A0A406C5837C94D0AC2901192BFEE2C03E7763D710525D980
Rebuild JSON:
{
"a": "111",
"b": "222",
"c": "333",
"nonce":"08AE0435-E68B-4460-835B-15475B58B75C",
"api_key":"kkkkkkkkk",
"sign":"7D2D6314B659E96A0A406C5837C94D0AC2901192BFEE2C03E7763D710525D980"
}
Signing ends.
IP Whitelist
When calling the enterprise wallet API, only the IP whitelist addresses you set are allowed to initiate requests, and you need to set the IP address for calling when creating the API Key.
Request Base URL
https://auth.openblock.com
API List
Get company wallet information
API Description
Type | Path | Method |
---|---|---|
Restful | /openapi/company_wallet/info/ | GET |
Input Parameters
None
Output
Field | Type | Description |
---|---|---|
company_wallet_info | object | Company wallet information |
--company_wallet_id | string | Company wallet id |
--wallet_name | string | Company wallet name |
--team_admin_members | int | Number of admin members |
--policy_members | int | Number of policy members |
role | string | User role, enum value: ADMIN/SUPER_ADMIN/GENERAL |
address_list | list | Chain address list |
--chain | string | Chain name |
--address | string | Chain address |
hd_wallet_list | list | Hd wallet list |
--hd_wallet_id | string | Hd wallet id |
--wallet_name | string | Hd wallet name |
Successful Response Example
{
"company_wallet_info":{
"company_wallet_id":"xxx",
"wallet_name":"Company wallet 1",
"team_admin_members":2,
"policy_members":1
},
"role":"ADMIN",
"address_list":[
{
"chain":"ETH",
"address":"xxxxx"
},
{
"chain":"Polygon",
"address":"xxxxx"
}
],
"hd_wallet_list":[
{
"hd_wallet_id":"xxxx",
"wallet_name":"hd wallet 1"
},
{
"hd_wallet_id":"xxxx",
"wallet_name":"hd wallet2"
}
]
}
Error Response Example
{
"ok": false,
"err_msg": "xxxx",
"err_code": xxxx
}
Get company wallet hd-wallet address
API Description
Type | Path | Method |
---|---|---|
Restful | /openapi/company_wallet/hd_wallet_address/ | GET |
Input Parameters
Field | Required | Type | Description |
---|---|---|---|
hd_wallet_id | Yes | string | Company wallet hd-wallet id |
Output
Field | Type | Description |
---|---|---|
address_list | list | Address list |
--chain | string | Chain name |
--address | string | Chain address |
Successful Response Example
{
"address_list":[
{
"chain":"ETH",
"address":"xxxxx"
},
{
"chain":"Polygon",
"address":"xxxxx"
}
]
}
Error Response Example
{
"ok": false,
"err_msg": "xxxx",
"err_code": xxxx
}
Get wallet balance
API Description
Type | Path | Method |
---|---|---|
Restful | /openapi/company_wallet/balance/ | GET |
Input Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
chain_name | Yes | string | Blockchain name | |
currency | No | string | USD | Base currency, enum value: CNY, USD |
hd_wallet_id | No | string | Company wallet hd-wallet id, main wallet if not passed | |
page | No | int | 0 | Page number |
limit | No | int | 20 | Page size |
Output
Field | Type | Description |
---|---|---|
total | int | Total records |
assets | array | List of assets |
- token_address | string | Token address |
- balance | string | Balance |
- decimal | int | Decimal places |
- symbol | string | Token symbol |
- currency_amount | string | Balance converted to base currency |
- price | string | Unit price |
Successful Response Example
{
"total": 5,
"assets": [
{
"token_address": "",
"balance": "0.003904238820258",
"decimal": 18,
"symbol": "ETH",
"currency_amount": "7.038835022814874345458984375",
"price": "1802.8699951171875"
},
{
"token_address": "0xe3c408bd53c31c085a1746af401a4042954ff741",
"balance": "0",
"decimal": 8,
"symbol": "GMT2",
"currency_amount": "0",
"price": "0"
},
{
"token_address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
"balance": "0",
"decimal": 8,
"symbol": "WBTC",
"currency_amount": "0",
"price": "26700"
},
{
"token_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"balance": "0",
"decimal": 6,
"symbol": "USDC",
"currency_amount": "0",
"price": "1.0010000467300415"
}
]
}
Error Response Example
{
"ok": false,
"err_msg": "xxxx",
"err_code": "xxxx"
}
Add Custom Token
API Description
Type | Path | Method |
---|---|---|
Restful | /openapi/company_wallet/custom_token/ | POST |
Input Parameters
Parameter | Required | Type | Description |
---|---|---|---|
chain_name | Yes | string | Blockchain name |
hd_wallet_id | No | string | Company wallet hd-wallet id, main wallet if not passed |
token_data | Yes | string | Token data in json object format, stringified |
- address | Yes | string | Token contract address |
- symbol | Yes | string | Token symbol |
- decimals | Yes | string | Token decimal places |
Output
Field | Type | Description |
---|---|---|
message | string | ok |
Input Example
{
"chain_name":"eth",
"token_data":"{\"address\": \"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599\", \"symbol\": \"WBTC\", \"decimals\": \"8\"}"
}
Successful Response Example
{
"message": "ok"
}
Error Response Example
{
"ok": false,
"err_msg": "xxxx",
"err_code": "xxxx"
}
Transaction History
API Description
Type | Path | Method |
---|---|---|
Restful | /openapi/company_wallet/tx_history/ | GET |
Input Parameters
Parameter | Required | Type | Description |
---|---|---|---|
chain_name | Yes | string | Blockchain name |
page | No | int | Page number, default 0 |
limit | No | int | Page size, default 20 |
order_by | No | string | Sort field, enum value: tx_time, block_number, default tx_time |
asc | No | int | Sort order, 0 descending, 1 ascending, default 0 |
hd_wallet_id | No | string | Company wallet hd-wallet id, main wallet if not passed |
Output
Field | Type | Description |
---|---|---|
page | int | Current page number |
limit | int | Number of data per page |
total | int | Total number of data |
data | array | Transaction record list |
- record_id | string | Transaction record ID |
- block_hash | string | Block hash |
- block_number | string | Block height |
- chain_name | string | Chain name |
- transaction_hash | string | Transaction hash |
- transaction_type | string | Transaction type |
- contract_address | string | Contract address |
- status | string | Status |
- tx_time | int | Transaction timestamp |
- from | string | Source address |
- to | string | Target address |
- amount | string | Amount |
- fee_amount | string | Fee amount |
- fee_data | string | Fee data |
- dapp_data | string | Dapp data |
- event_log | string | Event log |
- parse_data | string | Parsed data |
- client_data | string | Client data |
- operate_type | string | Operate type |
- transfer_id | string | Transfer ID |
- approve_logic_data | string | Approve logic data |
- company_wallet_approve_logic_data | string | Company wallet approve logic data |
- memo | string | Memo |
Successful Response Example
{
"page": 0,
"limit": 1,
// Total number of transaction history entries
"total": "6",
"data": [
{
"record_id": "1687743465",
"block_hash": "00000000031f2a40fc2741ee3c27484651e1052a99f9403d3ea08093fb99606f",
"block_number": "52374080",
"chain_name": "TRX",
"transaction_hash": "fee60897259e350c59805ac557019ade18e3c0971fa4d7528f74960ea2860d8a",
"transaction_type": "native",
"contract_address": "",
// Enumerated value: success,
"status": "success",
// Timestamp, in seconds
"tx_time": 1687743465,
"from": "TYuUmUBnqTGia5jjrmvUJieTUiTVvXEn4Z",
"to": "TSHGQ4sDHtYYawVuwAJh1d5yWc21BBonhE",
"amount": "1",
"fee_amount": "0",
"fee_data": "{\"energy_usage\":\"0\",\"fee_limit\":\"0\",\"net_usage\":\"265\"}",
"dapp_data": "",
"event_log": "",
"parse_data": "{\"token\":{\"address\":\"\",\"amount\":\"\",\"decimals\":0,\"symbol\":\"\"},\"tvm\":{}}",
"client_data": "",
"operate_type": "",
"transfer_id": "",
"approve_logic_data": "",
"company_wallet_approve_logic_data": null
},
]
}
Error Response Example
{
"ok": false,
"err_msg": "xxxx",
"err_code": xxxx
}
Get Approval List
Description
Type | Path | Method |
---|---|---|
Restful | /openapi/company_wallet/approvals/ | GET |
Input Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
page | No | int | 1 | Page number |
limit | No | int | 20 | Page size, max 20 |
status | No | string | ING | Approval status,ING:ing,FINISH:finished |
Output
Field | Type | Description |
---|---|---|
page | int | Current page number |
limit | int | Number per page |
data | array | Approval record list |
- cursor | int | Record cursor |
- record_id | string | Approval record ID |
- origin_record_id | string | Original approval record ID |
- my_status | string | My approval status |
- status | string | Overall approval status |
- company_wallet_id | string | Enterprise wallet ID |
- hd_wallet_id | string | hd wallet ID |
- wallet_name | string | Enterprise wallet name |
- approve_type | string | Approval type |
- action_type | string | Action type |
- origin_user_uuid | string | Initiator user ID |
- origin_user_account | string | Initiator account |
- create_time | string | Creation time |
- extra_data | object | Additional data |
-- txinfo | object | Transaction information |
Successful Response Example
{
"page": 3,
"limit": 1,
"data": [
{
"cursor": 28540,
"record_id": "7ce4b20f3d694ed38b74c1bf004a78e9",
"origin_record_id": "c4ee8c6b39844726a9216739f9cc211c",
"my_status": "REJECT",
"status": "REJECT",
"company_wallet_id": "81bb6cba42254be79aeabf5cfd23a90b",
"wallet_name": "企业钱包二期v1-1-1",
"approve_type": "TRANSACTION_APPROVE",
"action_type": "TRANSACTION",
"origin_user_uuid": "08f0d83dfe024d69af6bfaf9d5a592e4",
"origin_user_account": "P2",
"create_time": "2023-07-03 09:54:10",
"extra_data": {
"txinfo": {
"eip1559": true,
"to": "0xEC4fD89cf3aCf436Fe3be0310C3caa5834A04FE4",
"tokenAddress": "",
"from": "0xB2eC55D4756Ff87333bE6B7b7E273d5Cec0C9180",
"value": "0.00001",
"nonce": "34",
"gasLimit": "21000",
"gasPrice": "0",
"maxFeePerGas": "0.000000293",
"maxPriorityFeePerGas": "0.000000276",
"unit": "GWEI",
"shortHost": "",
"chain": "ETHGoerliTEST",
"isNative": true,
"token": {},
"data": "",
"google_record_id": "44e4fd99e91b4042af32836b884fca75",
"transaction_type": "native",
"isEnterpriseWallet": true,
"amount": "0.00001",
"symbol": "ETH",
"totalGas": "0.000000000006153",
"nativeCurrency": "ETH",
"txinput": {
"chainId": "BQ==",
"txMode": 1,
"maxInclusionFeePerGas": "ARQ=",
"maxFeePerGas": "ASU=",
"gasLimit": "Ugg=",
"nonce": "Ig==",
"transaction": {
"transfer": {
"amount": "CRhOcqAA"
}
},
"toAddress": "0xEC4fD89cf3aCf436Fe3be0310C3caa5834A04FE4"
},
"getPriceKey": "ethereum"
}
}
}
]
}
Error Response Example
{
"ok": false,
"err_msg": "xxxx",
"err_code": "xxxx"
}
Create Transaction Approval
API Description
API Description: Create Transaction Approval
Type | Path | Method |
---|---|---|
restful | /openapi/company_wallet/approval/new/ | POST |
Input Parameters
Parameter | Required | Type | Description |
---|---|---|---|
action | Yes | string | Approval type TRANSACTION = "Transfer" TRANSACTION_APPROVE = "Approval" TRANSACTION_CONTRACT_INTERACTION = "Contract interaction" |
hd_wallet_id | No | string | Company wallet hd-wallet id, main wallet if not passed |
txinfo | Yes | string (JSON object to string) | Transaction parameters |
--transaction_type | Yes | string | transaction type native: native transfer transfer: token transfer approve: token approve contract: contract transferNFT: nft transfer approveNFT: nft approve |
--chain | Yes | string | Chain name Supports the following chains: BTC ETH BSC SUI Aptos DOGE Kaspa Solana TRX Cosmos Osmosis Conflux ETC LTC OEC HECO Fantom Polygon Avalanche Cronos Klaytn xDai Optimism Arbitrum ArbitrumNova zkSync SmartBCH Harmony Ronin Nervos Casper Polkadot STC ETHGoerliTEST BSCTEST SUITEST zkSyncTEST ScrollL2TEST SeiTEST evm210425 |
--from | Yes | string | Sender address |
--to | No | string | Recipient address |
--tokenAddress | No | string | Token address, equired for token transfer, dapp deauthorization, nft transfer, and nft deauthorization |
--value | No | string | Transfer amount, required for native transfer, token transfer and nft transfer |
--nonce | No | string | Custom nonce |
--gasLimit | No | string | Chain parameter gasLimit |
--gasPrice | No | string | Chain parameter gasPrice |
--maxPriorityFeePerGas | No | string | Chain parameter maxPriorityFeePerGas |
--maxFeePerGas | No | string | Chain parameter maxFeePerGas |
--data | No | string | Dapp data, required for dapp authorization, nft authorization, and contract interaction |
--pretreatment_value | No | string | Pre-transaction value, eth, bsc, arb, polygon these chains when the contract interaction, If these chains do not fill in this value, the pre-transaction details cannot be resolved and will be approved according to the "Large Transaction Approval" (if any) approval flow. |
--token_id | No | string | Required for nft transfer |
--dappInfo | No | object | Dapp info |
----origin | No | string | Dapp origin |
----href | No | string | Dapp href |
----portName | No | string | Dapp port name |
----icon | No | string | Dapp icon |
----dappName | No | string | Dapp name |
Speed up and cancel input Parameters
Parameter | Required | Type | 描述 |
---|---|---|---|
txinfo | Yes | string (JSON object to string) | Transaction parameters |
--original_record_id | Yes | string | Original transaction approval origin_record_id |
--operate_type | Yes | string | Operate type, speed_up: speed up, cancel: cancel |
--gasLimit | No | string | Chain parameter gasLimit |
--gasPrice | No | string | Chain parameter gasPrice |
--maxPriorityFeePerGas | No | string | Chain parameter maxPriorityFeePerGas |
--maxFeePerGas | No | string | Chain parameter maxFeePerGas |
Output
Parameter | Type | Description |
---|---|---|
origin_record_id | string | Approval record ID of initiator |
record_id | int | The id of the approval details that are automatically passed, returned when there is an automatic pass |
is_auto_pass | int | Whether all pass automatically |
Input Example
Native token transfer:
{
"action": "TRANSACTION",
"txinfo": JSON.stringify({
"chain": "HECO",
"from": "0x5adE66b500B80070F3280198CEBA2Af830D8e0ab",
"to": "0x7620E9bbb6591b9F53b6b5002B716B8D23ca3950",
"value": "0.01",
"gasLimit": "97839",
"gasPrice":"0",
"maxPriorityFeePerGas": "2.25",
"maxFeePerGas": "2.25"
})
}
ERC20 token transfer:
{
"action": "TRANSACTION",
"txinfo": JSON.stringify({
"to":"0x7620E9bbb6591b9F53b6b5002B716B8D23ca3950",
"tokenAddress":"0xa71edc38d189767582c38a3145b5873052c3e47a",
"from":"0x5adE66b500B80070F3280198CEBA2Af830D8e0ab",
"value":"0.0001",
"nonce":"14",
"gasLimit":"63262",
"gasPrice":"0",
"maxFeePerGas":"2.475",
"maxPriorityFeePerGas":"2.475",
"chain":"HECO"
})
}
dapp token approve
{
"action": "TRANSACTION_APPROVE",
# convert to json string
"txinfo":JSON.stringify({
"from":"0x5adE66b500B80070F3280198CEBA2Af830D8e0ab",
"to":"0xa71edc38d189767582c38a3145b5873052c3e47a", //token address
"nonce":"14",
"gasLimit":"97839",
"maxPriorityFeePerGas":"2.25",
"maxFeePerGas":"2.25",
"chain":"HECO",
"data":"0x00000000",
"dappInfo":{
"origin":"https://app.dodoex.io",
"href":"https://app.dodoex.io/?from=USDT&network=heco&to=HT",
"portName":"https://app.dodoex.io1689171704045",
"icon":"https://dashboard-assets.dappradar.com/geRRcWz9IdTwSrm1/document/14738/dodo-dapp-exchanges-ethereum-logo_13c0bed361114265825072e6b01a2c03.png",
"dappName":"DODO"
}
})
}
dapp contract
{
"action": "TRANSACTION_CONTRACT_INTERACTION",
# convert to json string
"txinfo":JSON.stringify({
"from":"0x5adE66b500B80070F3280198CEBA2Af830D8e0ab",
"to":"0xbc3a8f63f311f3b005ff8afc1a26272faaba8d36", //DAPP spender contract address
"nonce":"14",
"gasLimit":"354052",
"maxPriorityFeePerGas":"2.25",
"maxFeePerGas":"2.25",
"chain":"HECO",
"data":"0x301a3720000000000000000000000000",
"value":"0.0001",
"amount":"0.0001",
"dappInfo":{
"origin":"https://app.dodoex.io",
"href":"https://app.dodoex.io/?network=heco&from=HT&to=USDT",
"portName":"https://app.dodoex.io1689171328132",
"icon":"https://dashboard-assets.dappradar.com/geRRcWz9IdTwSrm1/document/14738/dodo-dapp-exchanges-ethereum-logo_13c0bed361114265825072e6b01a2c03.png",
"dappName":"DODO"
}
})
}
cancle token approve
action: TRANSACTION_APPROVE
txinfo:
{
"transaction_type": "approve",
"to": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
"from": "0xd7f7Bf0dfCF8e6a3Fa9BB7013DcE5e3f6956c3cb", //DAPP spender contract address
"nonce": "16",
"gasLimit": "299979",
"gasPrice": "0.11",
"maxFeePerGas": "0",
"maxPriorityFeePerGas": "0",
"chain": "Arbitrum",
"isCancelTokenApprove": true,
"tokenAddress": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8" // token address
}
NFT transfer
action: TRANSACTION
txinfo:
{
"transaction_type": "transferNFT",
"to": "0x27D25bBDA38F681c34A514E74D4e193BC1c2f19E",
"from": "0xd7f7Bf0dfCF8e6a3Fa9BB7013DcE5e3f6956c3cb",
"value": "1",
"nonce": "15",
"gasLimit": "130977",
"gasPrice": "6.2964",
"maxFeePerGas": "0",
"maxPriorityFeePerGas": "0",
"chain": "xDai",
"token_id": "51004",
"tokenAddress": "0xCF964c89f509a8c0Ac36391c5460dF94B91daba5" //NFT token address
}
NFT approve
action: TRANSACTION_APPROVE
txinfo:
{
"transaction_type": "approveNFT",
"to": "0x44b3f42e2bf34f62868ff9e9dab7c2f807ba97cb", // NFT contract address
"from": "0xd7f7Bf0dfCF8e6a3Fa9BB7013DcE5e3f6956c3cb",
"value": "0",
"nonce": "238",
"gasLimit": "60591",
"maxFeePerGas": "195.1387121",
"maxPriorityFeePerGas": "47.73988292",
"chain": "Polygon",
"data": "0x000000000",
"dappInfo": {
"origin": "https://opensea.io",
"href": "https://opensea.io/account",
"portName": "https://opensea.io1697038498545",
"icon": "https://dashboard-assets.dappradar.com/document/13/opensea-dapp-marketplaces-ethereum-logo_a3421ac6e32d529db3c8293f4cfa9bcd.png",
"tokenGasless": {},
"isBlackListedDapp": false,
"dappName": "OpenSea"
}
}
NFT cancle approve
action: TRANSACTION_APPROVE
txinfo:
{
"transaction_type": "approveNFT",
"to": "0x1E0049783F008A0085193E00003D00cd54003c71", //DAPP spender contract address
"from": "0xd7f7Bf0dfCF8e6a3Fa9BB7013DcE5e3f6956c3cb",
"value": "0",
"nonce": "242",
"gasLimit": "35396",
"gasPrice": "0",
"maxFeePerGas": "84.86624019",
"maxPriorityFeePerGas": "41.21511274",
"chain": "Polygon",
"tokenAddress": "0x44b3f42e2BF34F62868Ff9e9dAb7C2F807ba97Cb", //NFT token address
"isCancelTokenApprove": true
}
speed up
txinfo:
{
"gasLimit": "21000",
"gasPrice": "0",
"maxFeePerGas": "70",
"maxPriorityFeePerGas": "35",
"operate_type": "speed_up",
"original_record_id": "05104d9fe7c2410a95dd0261fc771111"
}
Successful Response Example
{
"ok": true,
"data": {
"origin_record_id": "xxxx", # Sponsor's approval record ID
"is_auto_pass": true, # Whether auto approved
"record_id": "xxx",
}
}
Error Response Example
{
"ok": false,
"err_msg": "xxxx",
"err_code": "xxxx"
}
Approve/Reject Approval
API Description
API Description: Approve/Reject Approval.
Type | Path | Method |
---|---|---|
restful | /openapi/company_wallet/approval/agree/ | POST |
Input Parameters
Parameter | Required | Type | Description |
---|---|---|---|
record_id | Yes | string | Approval record ID, required for both agree and reject |
agree | Yes | string | agree/reject |
Success Response Example
{
"ok": true,
"data": {
"record_id": "xxxx",
"origin_record_id": "xxx", # Initiator's record ID
"status": "xxx",
}
}
Error Response Example
{
"ok": false,
"err_msg": "xxxx",
"err_code": xxxx
}
Webhook
Webhook Overview
Proactively notify events related to the enterprise wallet via webhook. Users can configure the webhook callback URL in the enterprise wallet API management page to receive notifications.
Request Description
Using the same authentication scheme as the API key, OpenBlock sends a POST
request to the Webhook callback address configured by the user, and the Content-Type
in the HTTP request header is application/json;charset=UTF-8
. After receiving the Webhook push notification, the user needs to return a successful response (HTTP status code 200), and the content of the successful response is success; when the platform receives a non-successful status code, it will consider that the push failed and will retry the push again. The frequency of re-push is 30s, 1m, 5m, 1h, 12h, 24h.
Event Format
Parameter | Type | Description |
---|---|---|
event_type | string | Callback event type |
event_detail | object | Callback event details |
Event Types
No. | event_type | Description |
---|---|---|
1 | CREATE_TRANSACTION | Create transfer transaction (calling approval/new API) |
2 | TRANSACTION_STATUS_CHANGE | Transaction status change (reject, all agree, etc) |
Event_detail Parameter Description
Parameter | Type | Description |
---|---|---|
record_id | string | Approval record ID |
company_wallet_id | string | Company wallet ID |
wallet_name | string | Company wallet name |
action_type | string | Approval type TRANSACTION = "Transfer" |
approve_type | string | Approval decision type SINGLE_APPROVE = 'Single approver' DESCISION_APPROVE = 'Decision model approval' ALL_ADMIN_APPROVE = 'All admins approval' TRANSACTION_APPROVE = 'Transaction approval flow' |
status | Approval status ING = "Approving" TRADING = "Agreed but action not taken" # Intermediate status for transaction approvals AGREE = "Approved" REJECT = "Rejected" DELETED = "Deleted" CANCEL = "Canceled" AUTO_TRADING = "Auto approved, action not taken" # Intermediate status for transaction approvals TIMEOUT = "Timed out" | |
extra_data | object | Additional data |
--txinfo | object | Transaction parameters |
agree_list | list | Approved users list |
ing_list | object | Approving users list |
Txinfo Parameter Description
Parameter | Type | Description |
---|---|---|
from | string | Sender address |
to | string | Recipient address |
tokenAddress | string | Token address |
value | string | Transaction amount |
nonce | string | Nonce |
gasLimit | string | Gas limit |
gasPrice | string | Gas price |
maxFeePerGas | string | Max fee per gas |
maxPriorityFeePerGas | string | Max priority fee per gas |
chain | string | Chain name |
isNative | bool | Is native token |
transaction_type | string | Transaction type, native: native token transfer, transfer: token transfer |
amount | string | Transaction amount |
symbol | string | Native token symbol |
nativeCurrency | string | Native token name |
Event_detail Example
{
"record_id": "672cbf141c0f4f988dec59678398a984",
"company_wallet_id": "2e3f75ebf9294fe68516f2d24cde74d3",
"wallet_name": "Enterprise Wallet 1",
"approve_type": "TRANSACTION_APPROVE",
"action_type": "TRANSACTION",
"status": "ING",
"is_simple_type": false,
"create_time": "2023-07-16 23:02:22",
"is_sponsor": true,
"approve_title_type": "TRADE_APPROVE_MODIFY",
"expired_time": null,
"extra_data": {
"txinfo": {
"eip1559": true,
"to": "0x27652D40eA3393caB38263A3Bdf268265dB00e42",
"tokenAddress": "",
"from": "0x5adE66b500B80070F3280198CEBA2Af830D8e0ab",
"value": "0.001",
"nonce": "38",
"gasLimit": "21000",
"gasPrice": "0",
"maxFeePerGas": "2.475",
"maxPriorityFeePerGas": "2.475",
"unit": "GWEI",
"shortHost": "",
"chain": "HECO",
"isNative": true,
"token": {},
"data": "",
"transaction_type": "native",
"isEnterpriseWallet": true,
"amount": "0.001",
"symbol": "HT",
"totalGas": "0.000051975",
"nativeCurrency": "HT",
"txinput": {
"chainId": "gA==",
"txMode": 1,
"maxInclusionFeePerGas": "k4WAwA==",
"maxFeePerGas": "k4WAwA==",
"gasLimit": "Ugg=",
"nonce": "Jg==",
"transaction": {
"transfer": {
"amount": "A41+pMaAAA=="
}
},
"toAddress": "0x27652D40eA3393caB38263A3Bdf268265dB00e42"
},
"getPriceKey": "huobi-token"
}
},
"origin_user_id": "dbfb1c42e43f4a80b22409e9a5707344",
"origin_user_account": "cc",
"agree_list": [
{
"user_id": "dbfb1c42e43f4a80b22409e9a5707344",
"account": "chen+6@gmail.com",
"nick_name": "cc",
"create_time": "2023-07-16 23:02:22",
"status": "init"
}
],
"ing_list": [
{
"node_name": "Node 1",
"valid_users_number": 2,
"total_users_number": 2,
"status": "ING",
"user_list": [
{
"user_id": "dbfb1c42e43f4a80b22409e9a5707344",
"account": "chenxxxx+6@gmail.com",
"nick_name": "cc",
"update_time": "2023-07-16 23:02:22",
"status": "AGREE"
},
{
"user_id": "00faf29f7d4744ee8a049110030a5cf3",
"account": "chenxxxx+2@gmail.com",
"nick_name": "jj",
"update_time": "2023-07-16 23:02:22",
"status": "ING"
}
]
}
]
}
Error Code
Error Code | Error Description |
---|---|
68000 | General error code, error description view err_msg |
50001 | Parameter error |
50002 | Duplicate nonce request |
50003 | Invalid API key |
50004 | Unavailable API key |
50005 | IP not allowed to access |
50006 | Invalid request signature |
50007 | Invalid wallet |
50008 | User exception |
50101 | Approval record does not exist |
50102 | Approval record not approved |
50103 | Original approval record completed |
more coming soon
Docker API
This project aims to provide users with the ability to sendTransaction locally, so that users can deploy wallet services on their own servers, instead of using the wallet services provided by Openblock.
Start
First, make sure you have installed Docker, then execute the following commands:
docker pull openblock/openblock:1.0.0
docker run -p 7790:7790 -d openblock/openblock:1.0.0
Use
Enter http://localhost:7790
, you will see the MPC unit import interface, follow the prompts to import your MPC unit, after the import is successful, you will see your enterprise wallet.
Signature interface
API Description
Path | Method |
---|---|
/openapi/sign/send_transaction | POST |
Query Parameters
Name | Required | Description |
---|---|---|
key | true | The API_KEY applied by the enterprise wallet |
Body Parameters
Name | Type | Required | Description |
---|---|---|---|
company_wallet_approve_record_id | string | true | Enterprise wallet approval id |
Successful Response Example
{
"code": 0,
"data": "",// txhash
}
Error Response Example
{
"code": 10001,
"message": "sign error"
}
API SDK
We provide API SDKs in golang/python:
Changelog
2023-12-28 v1.0.4
- Added GoLang and Python SDK
2023-10-26 v1.0.3
- Added support for company wallet hd wallet
- Deleted
Get all company wallets under a user account
interface, AddedGet company wallet information
,Get company wallet hd-wallet address
interfaces - Added support for creating speed up and cancel approval
2023-10-13 v1.0.2
- Added support for evm dapp authorization, contract interaction, NFT authorization, and NFT transfer transaction types
2023-09-20 v1.0.1
- Added docker image with send_transaction api (evm networks only)
- Interface path prefix changed from /oopenapi/v1 to /openapi
2023-07-31 v1.0.0
- Created API documentation
- Added
Get all company wallets under a user account
,Get wallet balance
,Add Custom Token
,Transaction History
,Get Approval List
,Create Transaction Approval
,Approve/Reject Approval
interfaces